
file(GLOB QGIS_UIS "${CMAKE_CURRENT_SOURCE_DIR}/*.ui")
file(GLOB SYMBOLLAYER_UIS "${CMAKE_CURRENT_SOURCE_DIR}/symbollayer/*.ui")
file(GLOB EDITORWIDGET_UIS "${CMAKE_CURRENT_SOURCE_DIR}/editorwidgets/*.ui")
file(GLOB PAINTEFFECT_UIS "${CMAKE_CURRENT_SOURCE_DIR}/effects/*.ui")
file(GLOB LABELING_UIS "${CMAKE_CURRENT_SOURCE_DIR}/labeling/*.ui")
file(GLOB LAYOUT_UIS "${CMAKE_CURRENT_SOURCE_DIR}/layout/*.ui")
file(GLOB PROCESSING_UIS "${CMAKE_CURRENT_SOURCE_DIR}/processing/*.ui")
file(GLOB AUTH_UIS "${CMAKE_CURRENT_SOURCE_DIR}/auth/*.ui")
file(GLOB RASTER_UIS "${CMAKE_CURRENT_SOURCE_DIR}/raster/*.ui")
file(GLOB STYLEDOCK_UIS "${CMAKE_CURRENT_SOURCE_DIR}/styledock/*.ui")
file(GLOB MESH_UIS "${CMAKE_CURRENT_SOURCE_DIR}/mesh/*.ui")
file(GLOB POINTCLOUD_UIS "${CMAKE_CURRENT_SOURCE_DIR}/pointcloud/*.ui")
file(GLOB _3D_UIS "${CMAKE_CURRENT_SOURCE_DIR}/3d/*.ui")
file(GLOB CALLOUT_UIS "${CMAKE_CURRENT_SOURCE_DIR}/callouts/*.ui")
file(GLOB NUMERICFORMAT_UIS "${CMAKE_CURRENT_SOURCE_DIR}/numericformats/*.ui")
file(GLOB ATTRIBUTEFORMCONFIG_UIS "${CMAKE_CURRENT_SOURCE_DIR}/attributeformconfig/*.ui")
file(GLOB GEOREFERENCER_UIS "${CMAKE_CURRENT_SOURCE_DIR}/georeferencer/*.ui")
file(GLOB ANNOTATION_UIS "${CMAKE_CURRENT_SOURCE_DIR}/annotations/*.ui")
file(GLOB SENSOR_UIS "${CMAKE_CURRENT_SOURCE_DIR}/sensor/*.ui")
file(GLOB TILED_SCENE_UIS "${CMAKE_CURRENT_SOURCE_DIR}/tiledscene/*.ui")

if (BUILD_WITH_QT6)
  QT6_WRAP_UI(QGIS_UIS_H
    ${QGIS_UIS}
    ${SYMBOLLAYER_UIS}
    ${EDITORWIDGET_UIS}
    ${PAINTEFFECT_UIS}
    ${PROCESSING_UIS}
    ${AUTH_UIS}
    ${RASTER_UIS}
    ${STYLEDOCK_UIS}
    ${LAYOUT_UIS}
    ${MESH_UIS}
    ${POINTCLOUD_UIS}
    ${_3D_UIS}
    ${CALLOUT_UIS}
    ${LABELING_UIS}
    ${NUMERICFORMAT_UIS}
    ${ATTRIBUTEFORMCONFIG_UIS}
    ${GEOREFERENCER_UIS}
    ${ANNOTATION_UIS}
    ${SENSOR_UIS}
    ${TILED_SCENE_UIS}
  )
else()
  QT5_WRAP_UI(QGIS_UIS_H
    ${QGIS_UIS}
    ${SYMBOLLAYER_UIS}
    ${EDITORWIDGET_UIS}
    ${PAINTEFFECT_UIS}
    ${PROCESSING_UIS}
    ${AUTH_UIS}
    ${RASTER_UIS}
    ${STYLEDOCK_UIS}
    ${LAYOUT_UIS}
    ${MESH_UIS}
    ${POINTCLOUD_UIS}
    ${_3D_UIS}
    ${CALLOUT_UIS}
    ${LABELING_UIS}
    ${NUMERICFORMAT_UIS}
    ${ATTRIBUTEFORMCONFIG_UIS}
    ${GEOREFERENCER_UIS}
    ${ANNOTATION_UIS}
    ${SENSOR_UIS}
    ${TILED_SCENE_UIS}
  )
endif()

set(QGIS_GUI_UI_HDRS ${QGIS_UIS_H} PARENT_SCOPE)

add_custom_target(ui ALL DEPENDS ${QGIS_UIS_H})

# target_sources for custom targets only available in cmake 3.20 and above,
# debian bullseye still has 3.18
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.20")
target_sources(ui
  PRIVATE
    qgsplaybackcontrollerwidgetbase.ui
)
endif(CMAKE_VERSION VERSION_GREATER_EQUAL "3.20")
